import { createRouter, createWebHistory } from 'vue-router';

import index from '../components/index.vue'
import login from '../components/Login2.vue'
import home from '../components/Home.vue'
import list from '../components/Home/List.vue'
import car from '../components/Home/Car.vue'
import info from '../components/Home/Info.vue'
import myInfo from '../components/Home/MyInfo.vue'


// 定义路由
const routes = [{
        path: '/',
        name: 'index',
        component: index,
    },
    {
        path: '/login',
        name: 'login',
        component: login,
    },
    {
        path: "/home",
        component: home,
        children: [{
                path: "list", // 商品信息
                component: list,
            },
            {
                path: "car", // 购物车
                component: car,
            },
            {
                path: 'info', // 咨询信息
                component: info,
            },
            {
                path: 'myinfo', // 个人信息
                component: myInfo,
            },

        ],
    },
];

// 创建router实例
const router = createRouter({
    history: createWebHistory(),
    routes,
});

// 对外暴露路由器
export default router;